<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	Xiaoshou xs = (Xiaoshou) request.getAttribute("xs");
	String contextPath = request.getContextPath();
	String msg = (String) request.getAttribute("msg");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="com.zhangyj.entitis.Xiaoshou"%>
<%@page import="com.zhangyj.component.ToolBar"%>
<%@page import="com.zhangyj.util.Tools"%><html>
<head>
<base target="_self">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@include file="/WEB-INF/jsps/head.jsp"%>
<style type="text/css">

td{
	padding-left:3px;
	padding-right:3px;
}
</style>
<script type="text/javascript">
function uf_selPro() {
	var url= "<%=contextPath%>/selector/product.do";
	var obj = _open(url,400,600);
	if (obj) {
		var form = document.forms["form1"];
		form["spmc"].value = obj["cpmc"];
		form["spdj"].value = obj["dj"];
		slchanged();
	}
}
function slchanged() {
	var form = document.forms["form1"];
	var val = Util.getSelectVal(form["spsl"]);
	form["spzj"].value=0;
	if (form["spdj"].value != "") {
		form["spzj"].value=form["spdj"].value * val;
	}
}
function uf_ok() {
	var form = document.forms["form1"];
	if (uf_validate() ) {
		form.submit();
	}
}
function uf_validate() {
	var form = document.forms["form1"];
	if (form["spmc"].value=="") {
		alert("请选择商品");
		return false;
	}
	var val = Util.getSelectVal(form["spsl"]);
	if (val ==0) {
		alert("请选择数量");
		return false;
	}
	return true;
}
function uf_load() {
	if ("<%=msg%>" != "null") {
		window.returnValue = true;
		window.close();
	}
}
</script>

</head>
<body onload="uf_load()">
<%
	ToolBar toolbar = new ToolBar();
	toolbar.setTitle("商品选择");
	toolbar.put(new ToolBar.Item("选择产品", "uf_selPro()"));
	toolbar.put(new ToolBar.Item("保存", "uf_ok()"));
	toolbar.put(new ToolBar.Item("关闭", "window.close()"));
	toolbar.writer(out);
%>
<form name="form1" action="<%=contextPath%>/order/xssave.do" onsubmit="return uf_validate()"
	method="post"><input type="hidden" name="xsid"
	value="<%=xs.getXsid()%>"> <input type="hidden" name="ddid"
	value="<%=xs.getDdid()%>">
	<%=com.zhangyj.entitis.SystemParam.getSystemParam(request).toInput() %>
<div style="text-aglin: left; padding-left: 10px;padding-right:10px;">
<table width="100%">
	<tr>
		<td>商品名称：</td>
		<td colspan="3"><input readonly="readonly" type="text" class="textbox"
			name="spmc" value="<%=xs.getSpmc()%>" /></td>
	</tr>
	<tr>
		<td style="width:20%">单 价：</td>
		<td style="width:30%"><input readonly="readonly" type="text" name="spdj" class="textbox"
			value="<%=xs.getSpdj()%>" /></td>
		<td style="width:20%">数 量：</td>
		<td style="width:30%"><%=Tools.builderSelect(0, 20, "spsl", xs.getSpsl(),	"onchange=\"slchanged()\"")%>
		</td>
	</tr>
	<tr>
		<td>总 价：</td>
		<td><input readonly="readonly" type="text" name="spzj" class="textbox"
			value="<%=xs.getSpzj()%>" /></td>
		<td>总 积 分：</td>
		<td><input type="text" name="spjf" value="<%=xs.getSpjf()%>"  class="textbox"/>
		</td>
	</tr>
</table>
</div>
<input type="button" onclick="uf_ok()" value="保存"> <input type="reset" value="清除">
</form>
</body>
</html>